package com19;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet(name = "one19Servlet")
public class one19Servlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletContext application=request.getServletContext();
        HttpSession session=request.getSession();
        application.setAttribute("sid",1);
        session.setAttribute("sname","mike");
        request.setAttribute("home","洪山区");
        System.out.println(request.getAttribute("home"));
        //response.sendRedirect("/web4/index1.jsp");
        request.getRequestDispatcher("/index1.jsp").forward(request,response);
    }
}
